package com.canbot.u05.activity.vipguide;

import android.app.Dialog;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import com.canbot.u05.R;
import com.canbot.u05.activity.BaseActivityNoTitle;
import com.canbot.u05.socket.MsgSendUtils;
import com.canbot.u05.socket.MsgType;
import com.canbot.u05.utils.PathConst;


/**
 * Created by cwf on 2017/5/25.
 * 贵宾导引首页
 */

public class VipGuideActivity extends BaseActivityNoTitle implements View.OnClickListener {


        private Dialog hintDialog;

        private String receptionRoute;

        private String isdialog;

        @Override
        protected void onCreate(@Nullable Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.activity_vip_guide);

                initView();
                String[] voices = {"u05_rsgb_001.wav", "u05_rsgb_002.wav", "u05_rsgb_003.wav","u05_htsz_001.wav", "u05_htsz_002.wav"};
                int index = (int) (Math.random() * voices.length);
                MsgSendUtils.sendStringMsg(MsgType.PLAY_SOUND, PathConst.VIP_GUIDE_DIR + voices[index]);
                receptionRoute = getIntent().getStringExtra("receptionRoute");
                isdialog = getIntent().getStringExtra("isdialog");

                if(!TextUtils.isEmpty(isdialog)){
                        showHintDialog();
                }

//                MsgSendUtils.sendStringMsg(MsgType.EYE_MOTION, "12");
//
//                if (index == 0) {
//                        MsgSendUtils.sendStringMsg(MsgType.ACTION, "14002");
//                }
//                else {
//                        MsgSendUtils.sendStringMsg(MsgType.ACTION, "14003");
//                }


        }

        private void showHintDialog() {
                if (hintDialog == null) {
                        hintDialog = new Dialog(this, R.style.MyDialogStyle);
                        hintDialog.setContentView(R.layout.vipguide_dialog_hint);
                        hintDialog
                                .findViewById(R.id.vip_dialog_hint_sure)
                                .setOnClickListener(this);
                        hintDialog
                                .findViewById(R.id.vip_dialog_hint_move)
                                .setOnClickListener(this);

                }
                String s1 = "当前接待地点："+receptionRoute;
                TextView textView1 = (TextView) hintDialog.findViewById(R.id.vip_dialog_tv);
                textView1.setText(s1);
                hintDialog.show();
        }

        private void initView() {
                findViewById(R.id.vip_manage).setOnClickListener(this);
                findViewById(R.id.vip_setting).setOnClickListener(this);
                findViewById(R.id.imageView_back).setOnClickListener(this);
        }

        @Override
        public void onClick(View view) {
                switch (view.getId()) {
                        case R.id.vip_manage:
                                startActivity(new Intent(VipGuideActivity.this, VipGuideTaskManageActivity.class));
                                break;
                        case R.id.vip_setting:
                                startActivity(new Intent(VipGuideActivity.this, KnowVipActivity.class));
                                break;
                        case R.id.imageView_back:
                                finish();
                                break;
                        case R.id.vip_dialog_hint_sure:
                                hintDialog.dismiss();
                                break;
                        case R.id.vip_dialog_hint_move:
                                hintDialog.dismiss();
                                startActivity(new Intent(VipGuideActivity.this, SiteSettingActivity.class)
                                        .putExtra("isreception","isreception"));
                                break;
                }

        }

        public void chooseRoute(View view) {
                //选择接待地点
                startActivity(new Intent(VipGuideActivity.this, SiteSettingActivity.class)
                        .putExtra("isreception", "isreception"));

        }

        @Override
        protected void onResume() {
                super.onResume();
        }


        @Override
        protected void onPause() {
                super.onPause();
        }



}
